package com.mingdao.lhy.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mingdao.lhy.mapper.wish.ArtSpecialtySignUpMapper;
import com.mingdao.lhy.mapper.wish.HighSchoolMapper;
import com.mingdao.lhy.mapper.wish.HighSchoolWishMapper;
import com.mingdao.lhy.pojo.HighSchool;
import com.mingdao.lhy.pojo.HighSchoolWish;
import com.mingdao.lhy.pojo.page.ArtSpecialtySignUp;

@Service
public class HighSchoolServiceImpl implements HighSchoolService {

	private static Logger log = LoggerFactory.getLogger(HighSchoolServiceImpl.class);

	@Autowired
	private HighSchoolMapper highSchoolMapper;

	@Autowired
	private ArtSpecialtySignUpMapper artSpecialtySignUpMapper;

	@Autowired
	private HighSchoolWishMapper highSchoolWishMapper;

	/**
	 * 根据学校代码返回学校信息
	 */
	@Override
	public HighSchool getHighSchoolById(String shoolId) {
		HighSchool highSchool = highSchoolMapper.getOne(shoolId);
		return highSchool;
	}

	@Override
	public int changePassword(HighSchool highSchool) {
		int result = highSchoolMapper.updatePasswordByPrimaryKey(highSchool);
		return result;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByGzxxdmArtSpecialtyYt(String gzxxdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("gzxxdm", gzxxdm);
		map.put("bmh", bmh);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByGzxxdmArtSpecialtyYt(map);
		return students;
	}

	@Override
	public List<ArtSpecialtySignUp> getWishedStudentByGzxxdmArtSpecialtyTs(String gzxxdm, String bmh) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("gzxxdm", gzxxdm);
		map.put("bmh", bmh);
		List<ArtSpecialtySignUp> students = artSpecialtySignUpMapper.getWishedStudentByGzxxdmArtSpecialtyTs(map);
		return students;
	}
	
	@Override
	public int updateHighSchoolExamineByBmhYt(String bmh) {
		int result = artSpecialtySignUpMapper.updateHighSchoolExamineByBmhYt(bmh);
		return result;
	}

	@Override
	public int updateHighSchoolCancelExamineByBmhYt(String bmh) {
		int result = artSpecialtySignUpMapper.updateHighSchoolCancelExamineByBmhYt(bmh);
		return result;
	}

	@Override
	public int updateHighSchoolScoreTs(ArtSpecialtySignUp artSpecialtySignUp) {
		int result = -1;
		result = artSpecialtySignUpMapper.updateByPrimaryKeySelectiveTs(artSpecialtySignUp);
		return result;
	}

	@Override
	public int updateHighSchoolScoreYt(ArtSpecialtySignUp artSpecialtySignUp) {
		int result = -1;
		result = artSpecialtySignUpMapper.updateByPrimaryKeySelectiveYt(artSpecialtySignUp);
		return result;
	}
	
	@Override
	public int updateHighSchoolExamineByBmhTs(String bmh) {
		int result = artSpecialtySignUpMapper.updateHighSchoolExamineByBmhTs(bmh);
		return result;
	}

	@Override
	public int updateHighSchoolCancelExamineByBmhTs(String bmh) {
		int result = artSpecialtySignUpMapper.updateHighSchoolCancelExamineByBmhTs(bmh);
		return result;
	}

//	@Override
//	public int updateHighSchoolScore2(ArtSpecialtySignUp artSpecialtySignUp) {
//		int result = -1;
//		result = artSpecialtySignUpMapper.updateByPrimaryKeySelective(artSpecialtySignUp);
//		return result;
//	}
	
	
	@Override
	public List<HighSchoolWish> getWishedStudentPage(int pageSize, int pageIndex) {
		Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("pageSize", pageSize );
		map.put("pageIndex", pageIndex);
		List<HighSchoolWish> students = highSchoolWishMapper.getWishedStudentPage(map);
		return students;
	}
}
